fixing database errors