fix db errors