fixed read on error