fixed database bug