Fixed issue #24. Added new test cases