Fix JENKINS-22344 and JENKINS-22451