fixed incorrect indexing in RoutingChain.insert