Corrected a problem with mkstemp function