Fixed runtime bugs. Still pbs in rerouting procedure.