remove write commands into script
fixed in case file is none
fixed to escape uri