add check for existance of tmp file name. #38