use pgrep instead of ps to get sudo pid

not sure why it behaves differently, but it does.