queue: fix missing ref.
ref_count: fix race when ref-debug is enabled.