Trying to fix an apparent memory leak...?