rewrite database error