fixed a seg fault and changed the router and host constructors.