Fix bug in new write routine.