Fixed karma errors in JS