fix requires middleware