update middleware