correct direciton calculation