Fixed issues with the db