binary write problem