Fix issue with cycle counting