implemented data integrity check