now fixed login required middleware