removed small (but looped) memory leaks