popEnv after compiling/flattening selectors

fixes issue #38