make sure we are creating the directory before accessing it