fix a buffer overflow