Fixed  previous error and add test case