When checking conditionals, don't dereference when the variable contains dashes

Fixes #4104