added some middleware stuff
added warning