Fixed db errors