Fixing the aplyRule loop counter reset.