Fix an exception that occurs when the free regex route exists

Fixes #1788