fix use freed memory