fixing test for checkIfTie() and rewriting the function