fixed type error in factory