Fix some bugs in scripts