Fixed run script bugs