script bug fix