creates working directories if necessary