modify Error checking