removed unused variables 'cnt' and 'protection_bit'