more robust html detection