add a routing test, fix some bugs