bug fix to script