fix up the read functions