Fix issue writing and reading across device boundaries.
Change page size variables to 16-bit types.