port1.Write(GPSbuffer, 0, GPSbuffer.Length); if (GPSbuffer[0] != 36) continue;
Those two lines seem a bit strange. First line: Why do you try to write the data back to the GPS?
Second line: are you sure that you want to skip all of the remaining part of the while-loop (including the reading from the IMU)?