Revert "Fix a couple of nasty heap corruption bugs."

This reverts commit 0b477dd62fc54796c2a4535eec8bff2f21f73141.