Fixes some memory problems, and a previous regression.