afm-run: fix bug in handling pids