fixed a bug in python script