Fixed a bug in the Python script