fixed some python bugs