Fix determining of obstruction in horizontal and vertical paths.