Fix recordings logic for environment variables detection