guard against null self.conn
(cherry picked from commit 972b9d3)
better handle database errors on initialization
(cherry picked from commit 01c81eb)
- Improved handling of database initalization errors