modified to fix log dir missing issue