Fix potential memory leak when unmounting

Fixes #781.
Spy on purgeID instead of unmountIDFromEnvironment
Merge pull request #786 from spicyj/gh-781

Fix potential memory leak when unmounting