fixed an initialization bug, seq.flag is false initially not true