Fixed issue with incorrect affected records count