Bugfix: was writing the same ID for all output sequences!  Reported by S. Kerr