diff --git a/flatland/envs/rail_env.py b/flatland/envs/rail_env.py
index 4c44afb74129d8bbe0d301e2198188858693dd28..2af0d8b962fc5b31e2e3c7607c06b8613c15a47a 100644
--- a/flatland/envs/rail_env.py
+++ b/flatland/envs/rail_env.py
@@ -320,15 +320,17 @@ class RailEnv(Environment):
 
                 # Perform stored action to transition to the next cell
 
-                # Now 'transition_action_on_cellexit' will be guaranteed to be valid; it was checked on entering
-                # the cell
                 cell_free, new_cell_valid, new_direction, new_position, transition_valid = \
                     self._check_action_on_agent(agent.speed_data['transition_action_on_cellexit'], agent)
 
+                # Check that everything is still fee and that the agent can move
                 if all([new_cell_valid, transition_valid, cell_free]):
                     agent.position = new_position
                     agent.direction = new_direction
                     agent.speed_data['position_fraction'] = 0.0
+                else:
+                    # If the agent cannot move due to any reason, we set its state to not moving.
+                    agent.moving = False
 
             if np.equal(agent.position, agent.target).all():
                 self.dones[i_agent] = True
diff --git a/notebooks/Scene_Editor.ipynb b/notebooks/Scene_Editor.ipynb
index 852fddb422fd2d8e6a6c51df993a183e45511982..1f653d00f7ca9880a36fcbb5c7286ef0e42ca658 100644
--- a/notebooks/Scene_Editor.ipynb
+++ b/notebooks/Scene_Editor.ipynb
@@ -70,7 +70,7 @@
     {
      "data": {
       "application/vnd.jupyter.widget-view+json": {
-       "model_id": "5a05a5f0569846dfa58fc6cfc222619a",
+       "model_id": "68a566e6228d40398ea8432582880311",
        "version_major": 2,
        "version_minor": 0
       },