Changed the order of disposal