The workaround for generated texture coordinates is to be done before calculating number of elements for attribute, otherwise counter wouldn't include those attributes.