fix potential crash in logger