Update environment variable, fixes #4824