fix a buffer corruption