ENG-4271 Backport ENG-4151 to 2.8.4.2, including unit test