Improvements to env loading.