added sleeps to wait for the pid file