fixed some mem leak