fix occassional core in Mem.cpp