Fix bug by only using sequence only once because it can be an iterator.