fixed bug with cycle counter