Fix bugs in pythons libs