diff --git a/flatland/envs/rail_generators.py b/flatland/envs/rail_generators.py
index ada43ce4e25353cc8e6e639b5a3d1ce6b00c4953..5fd8ba37be1fa763b199655b5d29419deb422447 100644
--- a/flatland/envs/rail_generators.py
+++ b/flatland/envs/rail_generators.py
@@ -792,6 +792,7 @@ def sparse_rail_generator(num_cities=5, grid_mode=False, max_inter_city_rails=4,
                     break
 
             opposite_boarder = (boarder + 2) % 4
+            track_direction = opposite_boarder
             boarder_one = inner_connection_points[current_city][boarder]
             boarder_two = inner_connection_points[current_city][opposite_boarder]