Fixed db bug