more precise variable checking