use mktemp for temporarily directory handling