middleware removed and some other fixes