Bug fixes for reading data.