IMO, 29e7b8a fixes the issue quite nicely (part of this commit is actually another fix that I've submitted as another PR -- #7450).