modifying loop protect js