Fix memory-leak-from-circuit bug