Fixed assert Nil and not nil when pointer to struct is passed
Added read and write methods to io stream