Ensures that mode is set based on SetEnv