Some bugs fixed (get_direction)