Fix crash when there are no pairs.