fix get_pk function