Fixed bounds problem in valid location test