Fix broken tests. Fixed insertBefore and text