imporved logging, minor fixes