Include recent changes

Integrating the memory fixes.
Also integrating other fixes that we are not affected by.