fix the bug in read_data that steve unfixed