minor changes to memory management