Corrected temp file name error and condition erro