Fixed some small bugs in PyObject conversions