fixing file i/o