Set ReferenceNumber correctly.