Fixed major bug with incorrect file descriptors, i/o is now fully functional