improve trace logging