Fixed a bug of IO error happening regarding temp.txt not existing