Fixed User env variable detection code