Fixed bug writing strings bigger than byteCount.
Fixed problems in Windows OS with file access