Fix db errors