fixed some bugs in the script