fixed destroy functions