Update router.js. Fixes #2897.