use std::vector instead of hand manipulation of list
fix 死循环