Fix db bug