[MODIF] Added necessary checks in unit-tests, fixed assignment of wrong
value for next_id.