remove extra flag and make sure the pid directory exists