implement hook of mkdtemp