Fix bug in logger logic