simplified code in exception.c, only read file if there is something to read