Fixing some python bugs.