fix error codes in python bindings