Re-apply fix for the Router class (reopens #2)

The fixes in pull request #2 have been reversed in the commit 48b3f7adcc6d4067e9853ee31a0466996e96dfcf.
This fixes the Router again.