Fix route name detection. Fixes #326.