You can avoid the problem by changing the sequences as follows:

ALTER SEQUENCE XXX NOCACHE;

Actually "avoid the problem" means avoid the problem with sequence gaps.
But you cannot avoid the problem; there is no such thing as a gapless sequence. For example, even with nocache set if someone calls seq.nextval and doesn't insert the value somewhere (or does insert it and later rolls back their transaction) that number is gone.