Created by: zhhsplendid
The main point of this PR is making sure the seq_len >= 0 to prevent potential dangerous behavior.
test=develop