Fix minor bugs in python version