[FIXED JENKINS-25635,JENKINS-25226] - Variables substitution issues

The fix addresses two major bugs discovered in perforce-1.3.28