Bugfix reading/writing tiled tiff images

We found a problem reading and writing tiled tiff images when the width or height is not multiple of the tile width / height.

I think both the problem and our solution are easy to spot from the source code, but if there is any doubt, feel free to contact me.

Thanks!