fixed bug with ties