added new stdout write function