Better route type parsing (fixes #471)