fixes bug in bounding boxes merge