Various tweaks and fixes
Only count number of valid records sent in preview