added max_error_region argument