Added little code to first create a temp-directory before doing anything in there.