Fix environment variable detection.