Revert "fix more memory leaks"

This reverts commit 84c6cdb06d79f84398fe32d3e1edbd0862df77d9.