Fixed ComputeDirection