some fixes including proper counters. About to branch