Fix handling of variables - use local