implementation of fallbacks for references (both normal link and img)