Cannot read property 'msgType' of undefined