Merge fixes to the python binding from my branch