finally fixed type confusion