ENG-5540 changed file declaration inside collect function