fix bugs and split router and proxy