Fixed js index error