Fixed some bugs with database.