fixed missing counter increment in getNames function