this is chenzhu's find_pid code