back to using a counter as Object.keys is unreliable and also bad performance wise