Added new test cases for Jaakko's fixes