fixed type mismatch in functions