fix object destruction memory bug