Issue 611 fix

Fix and test cases for issue #611.