Fixed has_error bug