Fixed some bugs reviewers found in the scripts