Fixes. Added test cases.