fix bug for writefile.sh