Fixed logging error, made more resilient in case of future logging erros