fix 'cannot save effect chain' bug.
The code to assign sequence numbers was buggy, is fixed