printf reclaced with write wrapper