Some error handling, to avoid death on encountering errors in log file.