Fix memory

Memory leaks plugged. But not so sure if operation not quite right (especially with ActionSet and subsumption).