added several bug fixes and fixes for wrong logs