Fix bug in dequeue_key() refactor.