index page script bug fix