fix bad return value check in reading and writing data.
Merge branch 'master' of github.com:tomicles/Boat_Projects