Fixed writing problem. had byte = v.front() instead of byte=*it