Fixes with exit status and pidfile