Added checks to see if doctype or errors was incorrectly determined
Fixed if statement error