Fixed local environment detection.