fixed errors
added additional testcases