add some comment, and free data where error