add ref to beginning of variables in procedures