fix a bug resulting from not updating seq->X.m

Also makes the realloc occur only if it needs to.