fix a memory corruption