improve logging & bugfix