Fix bogus unsigned to signed int conversion.

This leads to failures of computing VIA branches when hash label is higer than 2^31

(cherry picked from commit 2759890fcf41c1af1237206a0f97957cca1f635c)
Fix restoring route type and AVP list when droping branch.

Closes #365.

(cherry picked from commit 9e033465cb2328dd10b6e0ac0d09bf92136dfd33)