Handles ties correctly