use printf rather than echo for errors