a fix to write the right sequence numbers out