Fix JENKINS-13703

Subject says it all.
Hopefully this pull request speeds up fixing https://issues.jenkins-ci.org/browse/JENKINS-13703
The actual patch is taken from there (just extended the code comment slightly)

I also can confirm, that this patch indeed fixes the described bug here.