I have a feeling it has something to do with that 'not' at the beginning of the statement
Try (%tr !$= %mem.lastTR || %ev !$= %mem.lastEV) as a replacement for the first one, if I'm reading this correctly it should work the same as !(%tr $= %mem.lastTR && %ev $= %mem.lastEV)