update combineimages function