assertions and fixes recommended by Frama-C

all tests pass on 64bit