minor bug fix + new testcases