fixed bugs, added log. dosc to finish