[FIXED JENKINS-8478] Based on pull requests by xbeumala, mattakis and gauthierde