add counters and timers, fix various issues