Fixed computation of sizes during concatenation. Added invariants.