use reftype not ref to check code refs