Better error messages

Check the type of each chunk of data and compare with the types first
detected. Log a warning message if the types differ.