[JENKINS-16276] and various fixes for related exceptions