fix connection dying bug at line 217-218. Fix bug when router is not in db.