fixed bug in middleware type detection
typo in docs