some bug fix in scripts