There is a bug in the latitude/longitude bounds checking logic in two subroutines:
In both subroutines, the code checks the latitude bounds twice instead of checking both latitude and longitude. The issue arises from referencing lalodat(1), which represents latitude, in both conditions, effectively skipping the longitude check.