Fix various python issues