fix the middleware registration process in the container

Without this no middleware is being executed

@DeepDiver1975 @tanghus