update to protection function