Fixed error handling for errors.txt