fix a bug in seq, add more test cases