Patch and test for Issue #313.