add test and fix io ops