fixed some data reading bugs, but something still isn't right