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.