Fix cannot call method 'indexOf' of undefined error in Tracekit

closes #40