Added safe callback to all managed middlewares.