add check for corrupted data