Bug fixes for new environment initialization