updated InvalidArgumentException to UnexpectedTypeException