create tmp directory when not exist, add skip empty key

You indentation seems incorrect here.