fix script to create tmp directory when it does not exist, and fix entity name