Fix temp file bug