added nil-check for pk