Fix pg function to work when no pids are found

Signed-off-by: Konrad Scherer <Konrad.Scherer@windriver.com>