Reduced the scope of the event handler to a single request.

I have detected a a bug and fixed it.