Fix for wrong external env detection

bug was introduces with e28044f
Old commented code removed