Use more reliable variable checking