add some comments, and , fix some security errors