OK, got it sorted out. My tempBuffer array was one byte bigger than it needed to be so I was always copying a 0 from it to the global buffer (gBuffer). Sorry to have wasted your time ...