Fixed bug in read_dat.