Fix the variable scope sniff so that it can throw errors.