Fixed some issues with the database.