diff --git a/examples/introduction_flatland_2_1.py b/examples/introduction_flatland_2_1.py
index cd5c2ab43023bc796eb66b519d710266b97108f6..214f0c547af4adceda9e12194a3b4deafe3ffaae 100644
--- a/examples/introduction_flatland_2_1.py
+++ b/examples/introduction_flatland_2_1.py
@@ -25,10 +25,10 @@ from flatland.utils.rendertools import RenderTool, AgentRenderVariant
 # The railway infrastructure can be build using any of the provided generators in env/rail_generators.py
 # Here we use the sparse_rail_generator with the following parameters
 
-width = 50  # With of map
-height = 50  # Height of map
-nr_trains = 20  # Number of trains that have an assigned task in the env
-cities_in_map = 12  # Number of cities where agents can start or end
+width = 16*7  # With of map
+height = 9*7  # Height of map
+nr_trains = 10  # Number of trains that have an assigned task in the env
+cities_in_map = 20  # Number of cities where agents can start or end
 seed = 14  # Random seed
 grid_distribution_of_cities = False  # Type of city distribution, if False cities are randomly placed
 max_rails_between_cities = 2  # Max number of tracks allowed between cities. This is number of entry point to a city
@@ -58,7 +58,7 @@ schedule_generator = sparse_schedule_generator(speed_ration_map)
 # We can furthermore pass stochastic data to the RailEnv constructor which will allow for stochastic malfunctions
 # during an episode.
 
-stochastic_data = {'malfunction_rate': 20,  # Rate of malfunction occurence
+stochastic_data = {'malfunction_rate': 1000,  # Rate of malfunction occurence of single agent
                    'min_duration': 3,  # Minimal duration of malfunction
                    'max_duration': 20  # Max duration of malfunction
                    }
@@ -85,8 +85,8 @@ env.reset()
 env_renderer = RenderTool(env, gl="PILSVG",
                           agent_render_variant=AgentRenderVariant.AGENT_SHOWS_OPTIONS_AND_BOX,
                           show_debug=False,
-                          screen_height=1000,  # Adjust these parameters to fit your resolution
-                          screen_width=1000)  # Adjust these parameters to fit your resolution
+                          screen_height=600,  # Adjust these parameters to fit your resolution
+                          screen_width=800)  # Adjust these parameters to fit your resolution
 
 
 # The first thing we notice is that some agents don't have feasible paths to their target.
@@ -240,7 +240,7 @@ score = 0
 # Run episode
 frame_step = 0
 
-for step in range(100):
+for step in range(500):
     # Chose an action for each agent in the environment
     for a in range(env.get_num_agents()):
         action = controller.act(observations[a])
@@ -251,7 +251,8 @@ for step in range(100):
 
     next_obs, all_rewards, done, _ = env.step(action_dict)
 
-    env_renderer.render_env(show=True, show_observations=False, show_predictions=False)
+    env_renderer.render_env(show=False, show_observations=False, show_predictions=False)
+    env_renderer.gl.save_image('./misc/Fames2/flatland_frame_{:04d}.png'.format(step))
     frame_step += 1
     # Update replay buffer and train agent
     for a in range(env.get_num_agents()):
diff --git a/flatland/envs/rail_env.py b/flatland/envs/rail_env.py
index 2dcf4daf091cee74dc8625c1dffdd71b7605be01..053229e56680284998fd2fb7896c7d5246cee30d 100644
--- a/flatland/envs/rail_env.py
+++ b/flatland/envs/rail_env.py
@@ -250,6 +250,7 @@ class RailEnv(Environment):
         """
         self.agents = EnvAgent.list_from_static(self.agents_static)
         self.active_agents = [i for i in range(len(self.agents))]
+
     @staticmethod
     def compute_max_episode_steps(width: int, height: int, ratio_nr_agents_to_nr_cities: float = 20.0) -> int:
         """
@@ -423,7 +424,8 @@ class RailEnv(Environment):
         Malfunction generator that breaks agents at a given rate. It does randomly chose agent to break during the run
 
         """
-        if self.np_random.rand() < self._malfunction_prob(rate):
+        if self.np_random.rand() < self._malfunction_prob(rate, len(self.active_agents)):
+            print("Malfunction")
             # Select only from agents that are not done yet
             breaking_agent_idx = self.np_random.choice(self.active_agents)
             breaking_agent = self.agents[breaking_agent_idx]
@@ -960,13 +962,13 @@ class RailEnv(Environment):
         x = - np.log(1 - u) * rate
         return x
 
-    def _malfunction_prob(self, rate):
+    def _malfunction_prob(self, rate, n_agents):
         """
-        Gives the cummulative exponential distribution at point x, with exp decay rate
+        Probability that an agent break given the number of agents an the probability of a sinlge agent to break
         :param rate:
         :return:
         """
         if rate <= 0:
             return 0.
         else:
-            return 1 - np.exp(-(1 / rate))
+            return 1 - np.exp(- (1 / rate) * (n_agents))