fixed tie function