fixing the database bug