added log adapter
some optimization