rewrite most of part

fix so pointer error