Fixed bad logic for histogram merge.