Fix JENKINS-16575 and JENKINS-16566