Added pid check, fixed stuff.