bug fix in PythonEvents