fixes to memory