Manual Merge #1027

While reviewing #1027 I added another unit test to understand the issue. Fix by @petermd is good.