Fixed malformed HTML. Fixes issue #13
Fixed potential buffer over-run. Fixes issue #14.