tweak in Error checking