I used an if statement and not a while loop because I tried to read a write the half of bytes as a block !