Router.replace does not create items with NaN index in the locations array. Fix #306