protecting the magnetic layer