Sync router.js, closes #5167