fix some memory release bug