added update_errors function