Fix variable checking