fixed Bug in Direction Calculation