make and clean up tmp dir properly