fix a bug when searching for macro variables