ENG-5975: Refining the fix and adding debug output.