Fix temp file issues