add ref to pattern