Fix db issues