fix index off error

fix Uncaught TypeError: Cannot read property 'indexOf' of undefined

error happened when call off first