Fixed the tie logic