fix the same problem in PySpark