fixed database bug based due to table a refactoring