some python improvements