Prevent wrong total records to be inserted