The original code creates temporary file in the current directory, which may not always be writable. Change-Id: Icc278dd5db6be6206ae29defbb7423bae39cc978