Fixed a couple of bugs in the Python code.