We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Error with JS
Recently I clone the repository and I get this errors:

> map.built.js:227 Uncaught ReferenceError: center_lat is not defined
> 
> map.built.js:1082 Uncaught TypeError: Cannot read property 'setMapTypeId' of undefined
> 
> 19 map.built.js:677 Uncaught TypeError: Cannot read property 'getBounds' of undefined

Error with JS
Recently I clone the repository and I get this errors:

> map.built.js:227 Uncaught ReferenceError: center_lat is not defined
> 
> map.built.js:1082 Uncaught TypeError: Cannot read property 'setMapTypeId' of undefined
> 
> 19 map.built.js:677 Uncaught TypeError: Cannot read property 'getBounds' of undefined


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `runserver.py`
Content:
```
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 
4 import os
5 import sys
6 import shutil
7 import logging
8 import time
9 import re
10 import requests
11 
12 # Currently supported pgoapi
13 pgoapi_version = "1.1.6"
14 
15 # Moved here so logger is configured at load time
16 logging.basicConfig(format='%(asctime)s [%(threadName)16s][%(module)14s][%(levelname)8s] %(message)s')
17 log = logging.getLogger()
18 
19 # Make sure pogom/pgoapi is actually removed if it is an empty directory
20 # This is a leftover directory from the time pgoapi was embedded in PokemonGo-Map
21 # The empty directory will cause problems with `import pgoapi` so it needs to go
22 oldpgoapiPath = os.path.join(os.path.dirname(__file__), "pogom/pgoapi")
23 if os.path.isdir(oldpgoapiPath):
24     log.info("I found %s, but its no longer used. Going to remove it...", oldpgoapiPath)
25     shutil.rmtree(oldpgoapiPath)
26     log.info("Done!")
27 
28 # Assert pgoapi is installed
29 try:
30     import pgoapi
31 except ImportError:
32     log.critical("It seems `pgoapi` is not installed. You must run pip install -r requirements.txt again")
33     sys.exit(1)
34 
35 # Assert pgoapi >= 1.1.6 is installed
36 from distutils.version import StrictVersion
37 if not hasattr(pgoapi, "__version__") or StrictVersion(pgoapi.__version__) < StrictVersion(pgoapi_version):
38     log.critical("It seems `pgoapi` is not up-to-date. You must run pip install -r requirements.txt again")
39     sys.exit(1)
40 
41 from threading import Thread, Event
42 from queue import Queue
43 from flask_cors import CORS
44 
45 from pogom import config
46 from pogom.app import Pogom
47 from pogom.utils import get_args, insert_mock_data, get_encryption_lib_path
48 
49 from pogom.search import search_overseer_thread, fake_search_loop
50 from pogom.models import init_database, create_tables, drop_tables, Pokemon, Pokestop, Gym
51 
52 from pgoapi import utilities as util
53 
54 if __name__ == '__main__':
55     # Check if we have the proper encryption library file and get its path
56     encryption_lib_path = get_encryption_lib_path()
57     if encryption_lib_path is "":
58         sys.exit(1)
59 
60     args = get_args()
61 
62     if args.debug:
63         log.setLevel(logging.DEBUG);
64     else:
65         log.setLevel(logging.INFO);
66 
67     # Let's not forget to run Grunt / Only needed when running with webserver
68     if not args.no_server:
69         if not os.path.exists(os.path.join(os.path.dirname(__file__), 'static/dist')):
70             log.critical('Missing front-end assets (static/dist) -- please run "npm install && npm run build" before starting the server');
71             sys.exit();
72 
73     # These are very noisey, let's shush them up a bit
74     logging.getLogger('peewee').setLevel(logging.INFO)
75     logging.getLogger('requests').setLevel(logging.WARNING)
76     logging.getLogger('pgoapi.pgoapi').setLevel(logging.WARNING)
77     logging.getLogger('pgoapi.rpc_api').setLevel(logging.INFO)
78     logging.getLogger('werkzeug').setLevel(logging.ERROR)
79 
80     config['parse_pokemon'] = not args.no_pokemon
81     config['parse_pokestops'] = not args.no_pokestops
82     config['parse_gyms'] = not args.no_gyms
83 
84     # Turn these back up if debugging
85     if args.debug:
86         logging.getLogger('requests').setLevel(logging.DEBUG)
87         logging.getLogger('pgoapi').setLevel(logging.DEBUG)
88         logging.getLogger('rpc_api').setLevel(logging.DEBUG)
89 
90 
91     # use lat/lng directly if matches such a pattern
92     prog = re.compile("^(\-?\d+\.\d+),?\s?(\-?\d+\.\d+)$")
93     res = prog.match(args.location)
94     if res:
95         log.debug('Using coordinates from CLI directly')
96         position = (float(res.group(1)), float(res.group(2)), 0)
97     else:
98         log.debug('Looking up coordinates in API')
99         position = util.get_pos_by_name(args.location)
100 
101     # Use the latitude and longitude to get the local altitude from Google
102     try:
103         url = 'https://maps.googleapis.com/maps/api/elevation/json?locations={},{}'.format(
104             str(position[0]), str(position[1]))
105         altitude = requests.get(url).json()[u'results'][0][u'elevation']
106         log.debug('Local altitude is: %sm', altitude)
107         position = (position[0], position[1], altitude)
108     except requests.exceptions.RequestException:
109         log.error('Unable to retrieve altitude from Google APIs; setting to 0')
110 
111     if not any(position):
112         log.error('Could not get a position by name, aborting')
113         sys.exit()
114 
115     log.info('Parsed location is: %.4f/%.4f/%.4f (lat/lng/alt)',
116              position[0], position[1], position[2])
117 
118     if args.no_pokemon:
119         log.info('Parsing of Pokemon disabled')
120     if args.no_pokestops:
121         log.info('Parsing of Pokestops disabled')
122     if args.no_gyms:
123         log.info('Parsing of Gyms disabled')
124 
125     config['LOCALE'] = args.locale
126     config['CHINA'] = args.china
127 
128     app = Pogom(__name__)
129     db = init_database(app)
130     if args.clear_db:
131         log.info('Clearing database')
132         if args.db_type == 'mysql':
133             drop_tables(db)
134         elif os.path.isfile(args.db):
135             os.remove(args.db)
136     create_tables(db)
137 
138     app.set_current_location(position);
139 
140     # Control the search status (running or not) across threads
141     pause_bit = Event()
142     pause_bit.clear()
143 
144     # Setup the location tracking queue and push the first location on
145     new_location_queue = Queue()
146     new_location_queue.put(position)
147 
148     if not args.only_server:
149         # Gather the pokemons!
150         if not args.mock:
151             log.debug('Starting a real search thread')
152             search_thread = Thread(target=search_overseer_thread, args=(args, new_location_queue, pause_bit, encryption_lib_path))
153         else:
154             log.debug('Starting a fake search thread')
155             insert_mock_data(position)
156             search_thread = Thread(target=fake_search_loop)
157 
158         search_thread.daemon = True
159         search_thread.name = 'search_thread'
160         search_thread.start()
161 
162     if args.cors:
163         CORS(app);
164 
165     app.set_search_control(pause_bit)
166     app.set_location_queue(new_location_queue)
167 
168     config['ROOT_PATH'] = app.root_path
169     config['GMAPS_KEY'] = args.gmaps_key
170 
171     if args.no_server:
172         # This loop allows for ctrl-c interupts to work since flask won't be holding the program open
173         while search_thread.is_alive():
174             time.sleep(60)
175     else:
176         app.run(threaded=True, use_reloader=False, debug=args.debug, host=args.host, port=args.port)
177
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/runserver.py b/runserver.py
--- a/runserver.py
+++ b/runserver.py
@@ -41,6 +41,7 @@
 from threading import Thread, Event
 from queue import Queue
 from flask_cors import CORS
+from flask.ext import cache_bust
 
 from pogom import config
 from pogom.app import Pogom
@@ -162,6 +163,9 @@
     if args.cors:
         CORS(app);
 
+    # No more stale JS
+    cache_bust.init_cache_busting(app)
+
     app.set_search_control(pause_bit)
     app.set_location_queue(new_location_queue)

{"golden_diff": "diff --git a/runserver.py b/runserver.py\n--- a/runserver.py\n+++ b/runserver.py\n@@ -41,6 +41,7 @@\n from threading import Thread, Event\n from queue import Queue\n from flask_cors import CORS\n+from flask.ext import cache_bust\n \n from pogom import config\n from pogom.app import Pogom\n@@ -162,6 +163,9 @@\n     if args.cors:\n         CORS(app);\n \n+    # No more stale JS\n+    cache_bust.init_cache_busting(app)\n+\n     app.set_search_control(pause_bit)\n     app.set_location_queue(new_location_queue)\n", "issue": "Error with JS\nRecently I clone the repository and I get this errors:\n\n> map.built.js:227 Uncaught ReferenceError: center_lat is not defined\n> \n> map.built.js:1082 Uncaught TypeError: Cannot read property 'setMapTypeId' of undefined\n> \n> 19 map.built.js:677 Uncaught TypeError: Cannot read property 'getBounds' of undefined\n\nError with JS\nRecently I clone the repository and I get this errors:\n\n> map.built.js:227 Uncaught ReferenceError: center_lat is not defined\n> \n> map.built.js:1082 Uncaught TypeError: Cannot read property 'setMapTypeId' of undefined\n> \n> 19 map.built.js:677 Uncaught TypeError: Cannot read property 'getBounds' of undefined\n\n", "before_files": [{"content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nimport os\nimport sys\nimport shutil\nimport logging\nimport time\nimport re\nimport requests\n\n# Currently supported pgoapi\npgoapi_version = \"1.1.6\"\n\n# Moved here so logger is configured at load time\nlogging.basicConfig(format='%(asctime)s [%(threadName)16s][%(module)14s][%(levelname)8s] %(message)s')\nlog = logging.getLogger()\n\n# Make sure pogom/pgoapi is actually removed if it is an empty directory\n# This is a leftover directory from the time pgoapi was embedded in PokemonGo-Map\n# The empty directory will cause problems with `import pgoapi` so it needs to go\noldpgoapiPath = os.path.join(os.path.dirname(__file__), \"pogom/pgoapi\")\nif os.path.isdir(oldpgoapiPath):\n    log.info(\"I found %s, but its no longer used. Going to remove it...\", oldpgoapiPath)\n    shutil.rmtree(oldpgoapiPath)\n    log.info(\"Done!\")\n\n# Assert pgoapi is installed\ntry:\n    import pgoapi\nexcept ImportError:\n    log.critical(\"It seems `pgoapi` is not installed. You must run pip install -r requirements.txt again\")\n    sys.exit(1)\n\n# Assert pgoapi >= 1.1.6 is installed\nfrom distutils.version import StrictVersion\nif not hasattr(pgoapi, \"__version__\") or StrictVersion(pgoapi.__version__) < StrictVersion(pgoapi_version):\n    log.critical(\"It seems `pgoapi` is not up-to-date. You must run pip install -r requirements.txt again\")\n    sys.exit(1)\n\nfrom threading import Thread, Event\nfrom queue import Queue\nfrom flask_cors import CORS\n\nfrom pogom import config\nfrom pogom.app import Pogom\nfrom pogom.utils import get_args, insert_mock_data, get_encryption_lib_path\n\nfrom pogom.search import search_overseer_thread, fake_search_loop\nfrom pogom.models import init_database, create_tables, drop_tables, Pokemon, Pokestop, Gym\n\nfrom pgoapi import utilities as util\n\nif __name__ == '__main__':\n    # Check if we have the proper encryption library file and get its path\n    encryption_lib_path = get_encryption_lib_path()\n    if encryption_lib_path is \"\":\n        sys.exit(1)\n\n    args = get_args()\n\n    if args.debug:\n        log.setLevel(logging.DEBUG);\n    else:\n        log.setLevel(logging.INFO);\n\n    # Let's not forget to run Grunt / Only needed when running with webserver\n    if not args.no_server:\n        if not os.path.exists(os.path.join(os.path.dirname(__file__), 'static/dist')):\n            log.critical('Missing front-end assets (static/dist) -- please run \"npm install && npm run build\" before starting the server');\n            sys.exit();\n\n    # These are very noisey, let's shush them up a bit\n    logging.getLogger('peewee').setLevel(logging.INFO)\n    logging.getLogger('requests').setLevel(logging.WARNING)\n    logging.getLogger('pgoapi.pgoapi').setLevel(logging.WARNING)\n    logging.getLogger('pgoapi.rpc_api').setLevel(logging.INFO)\n    logging.getLogger('werkzeug').setLevel(logging.ERROR)\n\n    config['parse_pokemon'] = not args.no_pokemon\n    config['parse_pokestops'] = not args.no_pokestops\n    config['parse_gyms'] = not args.no_gyms\n\n    # Turn these back up if debugging\n    if args.debug:\n        logging.getLogger('requests').setLevel(logging.DEBUG)\n        logging.getLogger('pgoapi').setLevel(logging.DEBUG)\n        logging.getLogger('rpc_api').setLevel(logging.DEBUG)\n\n\n    # use lat/lng directly if matches such a pattern\n    prog = re.compile(\"^(\\-?\\d+\\.\\d+),?\\s?(\\-?\\d+\\.\\d+)$\")\n    res = prog.match(args.location)\n    if res:\n        log.debug('Using coordinates from CLI directly')\n        position = (float(res.group(1)), float(res.group(2)), 0)\n    else:\n        log.debug('Looking up coordinates in API')\n        position = util.get_pos_by_name(args.location)\n\n    # Use the latitude and longitude to get the local altitude from Google\n    try:\n        url = 'https://maps.googleapis.com/maps/api/elevation/json?locations={},{}'.format(\n            str(position[0]), str(position[1]))\n        altitude = requests.get(url).json()[u'results'][0][u'elevation']\n        log.debug('Local altitude is: %sm', altitude)\n        position = (position[0], position[1], altitude)\n    except requests.exceptions.RequestException:\n        log.error('Unable to retrieve altitude from Google APIs; setting to 0')\n\n    if not any(position):\n        log.error('Could not get a position by name, aborting')\n        sys.exit()\n\n    log.info('Parsed location is: %.4f/%.4f/%.4f (lat/lng/alt)',\n             position[0], position[1], position[2])\n\n    if args.no_pokemon:\n        log.info('Parsing of Pokemon disabled')\n    if args.no_pokestops:\n        log.info('Parsing of Pokestops disabled')\n    if args.no_gyms:\n        log.info('Parsing of Gyms disabled')\n\n    config['LOCALE'] = args.locale\n    config['CHINA'] = args.china\n\n    app = Pogom(__name__)\n    db = init_database(app)\n    if args.clear_db:\n        log.info('Clearing database')\n        if args.db_type == 'mysql':\n            drop_tables(db)\n        elif os.path.isfile(args.db):\n            os.remove(args.db)\n    create_tables(db)\n\n    app.set_current_location(position);\n\n    # Control the search status (running or not) across threads\n    pause_bit = Event()\n    pause_bit.clear()\n\n    # Setup the location tracking queue and push the first location on\n    new_location_queue = Queue()\n    new_location_queue.put(position)\n\n    if not args.only_server:\n        # Gather the pokemons!\n        if not args.mock:\n            log.debug('Starting a real search thread')\n            search_thread = Thread(target=search_overseer_thread, args=(args, new_location_queue, pause_bit, encryption_lib_path))\n        else:\n            log.debug('Starting a fake search thread')\n            insert_mock_data(position)\n            search_thread = Thread(target=fake_search_loop)\n\n        search_thread.daemon = True\n        search_thread.name = 'search_thread'\n        search_thread.start()\n\n    if args.cors:\n        CORS(app);\n\n    app.set_search_control(pause_bit)\n    app.set_location_queue(new_location_queue)\n\n    config['ROOT_PATH'] = app.root_path\n    config['GMAPS_KEY'] = args.gmaps_key\n\n    if args.no_server:\n        # This loop allows for ctrl-c interupts to work since flask won't be holding the program open\n        while search_thread.is_alive():\n            time.sleep(60)\n    else:\n        app.run(threaded=True, use_reloader=False, debug=args.debug, host=args.host, port=args.port)\n", "path": "runserver.py"}], "after_files": [{"content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nimport os\nimport sys\nimport shutil\nimport logging\nimport time\nimport re\nimport requests\n\n# Currently supported pgoapi\npgoapi_version = \"1.1.6\"\n\n# Moved here so logger is configured at load time\nlogging.basicConfig(format='%(asctime)s [%(threadName)16s][%(module)14s][%(levelname)8s] %(message)s')\nlog = logging.getLogger()\n\n# Make sure pogom/pgoapi is actually removed if it is an empty directory\n# This is a leftover directory from the time pgoapi was embedded in PokemonGo-Map\n# The empty directory will cause problems with `import pgoapi` so it needs to go\noldpgoapiPath = os.path.join(os.path.dirname(__file__), \"pogom/pgoapi\")\nif os.path.isdir(oldpgoapiPath):\n    log.info(\"I found %s, but its no longer used. Going to remove it...\", oldpgoapiPath)\n    shutil.rmtree(oldpgoapiPath)\n    log.info(\"Done!\")\n\n# Assert pgoapi is installed\ntry:\n    import pgoapi\nexcept ImportError:\n    log.critical(\"It seems `pgoapi` is not installed. You must run pip install -r requirements.txt again\")\n    sys.exit(1)\n\n# Assert pgoapi >= 1.1.6 is installed\nfrom distutils.version import StrictVersion\nif not hasattr(pgoapi, \"__version__\") or StrictVersion(pgoapi.__version__) < StrictVersion(pgoapi_version):\n    log.critical(\"It seems `pgoapi` is not up-to-date. You must run pip install -r requirements.txt again\")\n    sys.exit(1)\n\nfrom threading import Thread, Event\nfrom queue import Queue\nfrom flask_cors import CORS\nfrom flask.ext import cache_bust\n\nfrom pogom import config\nfrom pogom.app import Pogom\nfrom pogom.utils import get_args, insert_mock_data, get_encryption_lib_path\n\nfrom pogom.search import search_overseer_thread, fake_search_loop\nfrom pogom.models import init_database, create_tables, drop_tables, Pokemon, Pokestop, Gym\n\nfrom pgoapi import utilities as util\n\nif __name__ == '__main__':\n    # Check if we have the proper encryption library file and get its path\n    encryption_lib_path = get_encryption_lib_path()\n    if encryption_lib_path is \"\":\n        sys.exit(1)\n\n    args = get_args()\n\n    if args.debug:\n        log.setLevel(logging.DEBUG);\n    else:\n        log.setLevel(logging.INFO);\n\n    # Let's not forget to run Grunt / Only needed when running with webserver\n    if not args.no_server:\n        if not os.path.exists(os.path.join(os.path.dirname(__file__), 'static/dist')):\n            log.critical('Missing front-end assets (static/dist) -- please run \"npm install && npm run build\" before starting the server');\n            sys.exit();\n\n    # These are very noisey, let's shush them up a bit\n    logging.getLogger('peewee').setLevel(logging.INFO)\n    logging.getLogger('requests').setLevel(logging.WARNING)\n    logging.getLogger('pgoapi.pgoapi').setLevel(logging.WARNING)\n    logging.getLogger('pgoapi.rpc_api').setLevel(logging.INFO)\n    logging.getLogger('werkzeug').setLevel(logging.ERROR)\n\n    config['parse_pokemon'] = not args.no_pokemon\n    config['parse_pokestops'] = not args.no_pokestops\n    config['parse_gyms'] = not args.no_gyms\n\n    # Turn these back up if debugging\n    if args.debug:\n        logging.getLogger('requests').setLevel(logging.DEBUG)\n        logging.getLogger('pgoapi').setLevel(logging.DEBUG)\n        logging.getLogger('rpc_api').setLevel(logging.DEBUG)\n\n\n    # use lat/lng directly if matches such a pattern\n    prog = re.compile(\"^(\\-?\\d+\\.\\d+),?\\s?(\\-?\\d+\\.\\d+)$\")\n    res = prog.match(args.location)\n    if res:\n        log.debug('Using coordinates from CLI directly')\n        position = (float(res.group(1)), float(res.group(2)), 0)\n    else:\n        log.debug('Looking up coordinates in API')\n        position = util.get_pos_by_name(args.location)\n\n    # Use the latitude and longitude to get the local altitude from Google\n    try:\n        url = 'https://maps.googleapis.com/maps/api/elevation/json?locations={},{}'.format(\n            str(position[0]), str(position[1]))\n        altitude = requests.get(url).json()[u'results'][0][u'elevation']\n        log.debug('Local altitude is: %sm', altitude)\n        position = (position[0], position[1], altitude)\n    except requests.exceptions.RequestException:\n        log.error('Unable to retrieve altitude from Google APIs; setting to 0')\n\n    if not any(position):\n        log.error('Could not get a position by name, aborting')\n        sys.exit()\n\n    log.info('Parsed location is: %.4f/%.4f/%.4f (lat/lng/alt)',\n             position[0], position[1], position[2])\n\n    if args.no_pokemon:\n        log.info('Parsing of Pokemon disabled')\n    if args.no_pokestops:\n        log.info('Parsing of Pokestops disabled')\n    if args.no_gyms:\n        log.info('Parsing of Gyms disabled')\n\n    config['LOCALE'] = args.locale\n    config['CHINA'] = args.china\n\n    app = Pogom(__name__)\n    db = init_database(app)\n    if args.clear_db:\n        log.info('Clearing database')\n        if args.db_type == 'mysql':\n            drop_tables(db)\n        elif os.path.isfile(args.db):\n            os.remove(args.db)\n    create_tables(db)\n\n    app.set_current_location(position);\n\n    # Control the search status (running or not) across threads\n    pause_bit = Event()\n    pause_bit.clear()\n\n    # Setup the location tracking queue and push the first location on\n    new_location_queue = Queue()\n    new_location_queue.put(position)\n\n    if not args.only_server:\n        # Gather the pokemons!\n        if not args.mock:\n            log.debug('Starting a real search thread')\n            search_thread = Thread(target=search_overseer_thread, args=(args, new_location_queue, pause_bit, encryption_lib_path))\n        else:\n            log.debug('Starting a fake search thread')\n            insert_mock_data(position)\n            search_thread = Thread(target=fake_search_loop)\n\n        search_thread.daemon = True\n        search_thread.name = 'search_thread'\n        search_thread.start()\n\n    if args.cors:\n        CORS(app);\n\n    # No more stale JS\n    cache_bust.init_cache_busting(app)\n\n    app.set_search_control(pause_bit)\n    app.set_location_queue(new_location_queue)\n\n    config['ROOT_PATH'] = app.root_path\n    config['GMAPS_KEY'] = args.gmaps_key\n\n    if args.no_server:\n        # This loop allows for ctrl-c interupts to work since flask won't be holding the program open\n        while search_thread.is_alive():\n            time.sleep(60)\n    else:\n        app.run(threaded=True, use_reloader=False, debug=args.debug, host=args.host, port=args.port)\n", "path": "runserver.py"}]}