Fixed bug with determination of ties