Fix environment variable handling on Windows