Fixed writing the bytes