Changed Py_XDECREF calls to avoid double free.

@bjorn Your suggestion does seem to fix the problem for me. Here's the implementation if you want it.