fix many bugs in file i/o and scheduling

still need to fix issue with application thinking it's time to quit and
cutting out prematurely