Fixed chains counting issue.