fixed type checking error, added negative test cases