changed waitOn function of router