Improve path matching