Minor fixes

Fixed read/write pointer init
Work on fwrite