fix PREFAST warnings about inner scope variables hiding outer scope variables #3590