Fixed bugs in router