added exist middleware