matchRoutes: fix no match case and correct handling of tail