added if statement that checks for tie