Fix temp file issue