Fix crash on 404 with routes containing unsafe characters