Solve reference counting bug.
Clean up.