Fixed writing and reading of bytes