fix some double frees