A few fixes to the memory management API.