Fix issue writing and reading across device boundaries.