Potential fix for issue #15

This fix seems to address the issue #15, but may have unintended consequences.  I haven't been able to create a test case that breaks it yet.