Updating database after error