fix some mem leak issue