Added test cases, fixed bugs tests found