Fix pointer issues in destroy method