correct invalid img and br elements and also missing close div