[BUGFIX] Ensure that pid is not NULL, issue #12