fixed a potential bug in scripts