Fixes a few bugs with router