fix some routing error, add functional test program