FIxed a bug with the last checkin

Last check-in - Tried to set the content length after writing has
occurred - caused an error. Set Length in appropriate place.
Merge pull request #8 from Astro03/master

FIxed a bug with the last checkin