[ATK14] Better auto detection of environment