database bug fix