Patch for bug #2536

Fixes #2536

See http://trac.buildbot.net/ticket/2536