Fix Python errors