use printf instead of writefile