fix some additional program refcounting bugs
3 files changed