Correct bugs in python interface