when freeing priority_cache make sure it is set to NULL
always set subkey status
correctly address cookie