small changes
changes to deal with type="both"