Cherry pick patch code from TEMPLETON-28 to merge into condor to fix BUG-2788