replace tempfile with mktemp for centos