fixed type error handling