fixed a bug in the script