fix a database bug