fix for possible crash when opening log file