Fix router bugs