Fixed average wait time issue and temp file issue.