helper functions, improve trace output