fixed bug with zero length strings
handling 0 array lenghts for fread/fwrite