added tie detection