add insertAdjacentHTML optimization + fix bugs