Fixed null input, and ast double read of contents
Fixed bug in utf8 errors