Fixed breaking if db empty