added log synchronization, added more logging