fixed error in readout code