Fix Stats to not try to not try to process a record after it is out of the loop since the record might be invalid