fixed null pointer dereferencing
fix io channel init