Fix tmp directory bug