fix for forgetMiddleware function

forgetMiddleware function was checking an object against a (string) class name so it would never match and remove the middleware.