update main protection function