fixed a bug in the python script