diff --git a/src/analysis.py b/src/analysis.py
index 24b793fde59cd76588a8cfac9d7275160a75cc03..2d0b342280ec5ea41c57571f41c765bb5ca2e6bd 100644
--- a/src/analysis.py
+++ b/src/analysis.py
@@ -59,7 +59,7 @@ class DB:
         SELECT COUNT(osm_id) FROM exp_building_small WHERE way && {selection} LIMIT {n_limit};
 '''.format(**constraints)
         logging.debug(query)
-        
+
         async with self.connection.cursor() as cur:
             await cur.execute(query)
             result = await cur.fetchall()
@@ -70,7 +70,8 @@ class DB:
         return result
 
     def __del__(self):
-        self.connection.close()
+        if self.connection:
+            self.connection.close()
 
 # Tutorial on how to work on pixel level:
 #  https://www.endpoint.com/blog/2018/09/12/postgis-raster-generation
diff --git a/src/api.py b/src/api.py
index 19f82a2d02964a3ddbbff6864784cb75125c851f..c21dee14ee58b9464ded33c4c81dd193534c6a80 100644
--- a/src/api.py
+++ b/src/api.py
@@ -67,7 +67,12 @@ async def handle_shakemap(request):
     geojson = await loop.run_in_executor(
         None, sm_process.process, *tuple(kwargs.values()))
 
-    building_shaking = await sm_process.building_count(geojson)
+    # try:
+    #     building_shaking = await sm_process.building_count(geojson)
+    # except Exception as e:
+    #     logger.exception(e)
+    #     building_shaking = {}
+    building_shaking = {}
 
     json_content = json.dumps({
         'shakemap': geojson,
@@ -148,4 +153,5 @@ if __name__ == '__main__':
         resource_shakemap.add_route("GET", handle_gmpes), {
             "*": default_resource_options})
 
+    logger.info('starting api on port 8082')
     web.run_app(app, port=8082)
diff --git a/src/shakemap_lite_process.py b/src/shakemap_lite_process.py
index 876b3a9667d6b4d2407ae4c20550487148ce5c17..f4c7daffcc2caf38fa98f54e5b2a1064147147f8 100644
--- a/src/shakemap_lite_process.py
+++ b/src/shakemap_lite_process.py
@@ -66,7 +66,7 @@ def to_contour(data, lats, lons):
     return d
 
 
-def process(event: sml.Event, gmpe: str, imt: str, 
+def process(event: sml.Event, gmpe: str, imt: str,
             margin: float = 3, format: str = 'contour'):
 
     assert format in ('contour', 'grid'), 'format has to be either contour or grid'