fix some python mode bug