add more checks for corrupted data