fix attempt to index field 'action' (a nil value)

Not sure what caused this. seems like :gsub is resolving stuff it doesn't need to use, which is causing reference errors due to nil value variables that aren't expected to be populated for the message. i.e. the error shows on a ${spell} replacement, when the output line has no ${spell}.  I'm open to other suggestions for fixing this.