Fix JENKINS-18936
FIx JENKINS-19326
Fix JENKINS-19033
Enhance code