Integration test for IO added (found several bugs)