rewrite some, still has bug
fix element not complete problem