changing NaN check for invalid touch position