Fix scope of variables in method inspect