db bug fixing