Remove unnecessary environments.