fixes to the new memory management system