Work on bad accesses and then memory leaks.

This wasn't necessary before since we were incorrectly using static storage from conversion functions for this purpose.