I would agree with Karl. I think I found WAITUNTIL was flakey at detecting I/O events. The only place I used it was:
WAITUNTIL STOP
to ensure that axis motion had stopped before logic continues.
Do you not have any encoders on your machine? I'd be leery of using something as crude as a switch for an exact, repeatable home detection. It could be a shame to sweat writing the logic, only to never have it perform to expectations.
First you get good, then you get fast. Then grouchiness sets in.
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)