added checking for disconnected dbs