fix deps and middleware