fix newline bug when adding classes to elements