resolve_ref(): turn buffer into a proper string as soon as possible