modified a bit repeat detection in order to use repeatPermit 0