use dprintf(1,..) instead of buffered stderr