fix error in endpoint pattern matching