Intermittent bug with #IF( %sym ) - %sym seems to be Null when it fails

I’m using

#IF( NOT VarExists(%sym))
#Error('some msg')
#Else
#IF(NOT %sym)
#Insert(%AddDefaults)
#EndIF
#EndIF

Its an intermittent bug which I havent got to the bottom of what causes it, so for now the message will be sufficient.

I only got to the bottom of the fact the %sym appears to be null just the other day so hopefully this should be sufficient, but the existence of VarExists() says alot about how symbols & scope are handled.