fixed NPE, fixed routing bug