fixed buggy logger function