Fix OnStraightLine function