Fix problems with html documents containing one or more base elements