modify the check ior function