some critical changes to reorg p_k_v