added log handling