Improve environment variables detection for recordings