Fixed issue with Logger

+more robust code