check middleware