Yeah, I'll explain
I got tired of writing scripts/xmlChecker.sh, so I added scripts to my PATH, and I call xmlCheck.sh simply.
This broke the finding of the top directory and I had to implement the above fragment to fix the problem.