added counter for affected records