Fixing database errrors.