diff --git a/lib/ga_events/middleware.rb b/lib/ga_events/middleware.rb
index <HASH>..<HASH> 100644
--- a/lib/ga_events/middleware.rb
+++ b/lib/ga_events/middleware.rb
@@ -9,7 +9,7 @@ module GaEvents
       # Handle events stored in flash
       # Parts borrowed from Rails:
       # https://github.com/rails/rails/blob/v3.2.14/actionpack/lib/action_dispatch/middleware/flash.rb
-      flash = env['rack.session'] && env['rack.session']['flash']
+      flash = env['rack.session'] && env['rack.session']['flash'] && env['rack.session']['flash']['flashes']
       GaEvents::List.init(flash && flash['ga_events'])
 
       status, headers, response = @app.call(env)
the hash key for extracting the flash content in the middleware was wrong (at least working with rails <I>)