removed reference to existing db, handled exception thrown when no db is available

Signed-off-by: Marcin Wiatr <mail.wichura@gmail.com>