Fixed a bug in the python script