Issue #1089: Add a test
Issue #1089: Fix for the comparisons, but we're transforming the middle term twice