Fix doc_to_addr(undefined) issue