JMD – Cannot read property 'substr' of undefined