Fixing some DOM insertion troubles