clear error var only if provided