fix database bug