Here's that change as a proper patch with the original testcase added asa regression test.
-- Andrew (irc:RhodiumToad)