fixing db errors