Use create_tmp_directory method instead of creating directories directly. Fixes exception