fixed read function