Fix temp dir bug