fix a memory error