added log and disconnect