fixed NPE when using logger
added test