fix temp file leak