Added check for connection and gps.