Added better error checking for gps data