[Bugfix] only try to insert JS if JS is created