fix refcounting and error handling bugs in last commit
fix refcounting and error handling bugs in last commit

cython/cython,da-woods/cython,da-woods/cython,scoder/cython,da-woods/cython,cython/cython,cython/cython,scoder/cython,da-woods/cython,scoder/cython,cython/cython,scoder/cython