Fixed a database bug