Another round of memory fixes.