Fix nasty overflowing bug.

Fix bug causing to reserve 4GB of unused memory on 64bit systems.
The problem was in
  string.reserve(a - b + c + d - e)
The types of a, b, d, e are unsigned, type of c size_t. Therefore, the
first (a-b) is computed modulo 2^32. Then, the result is 64-bit
extended. So, if a < b, the result is off by 2^32.

Fixed by reordering the numbers, to c + a - b + d - e.