Updated the support of environment variables to the new way