fix segfault when logging is on for file open errors