My best guess is this line:
if (userNotice[6].indexOf('resub') >= 0)
You’re already inside of a USERNOTICE, so you know it is a resub. Try removing that and see if it is more consistent.
My best guess is this line:
if (userNotice[6].indexOf('resub') >= 0)
You’re already inside of a USERNOTICE, so you know it is a resub. Try removing that and see if it is more consistent.