JENKINS-21429 initial fix did not work for all use cases