fixing bugs in scripts