Fix some memory leaks and make use of BaseCycleContainer::reset