Fixed issues with database.