Adding fix & test cases for issue #23