trace logging, minor fixes