Fixed bugs in reading in from hdf5