better trace handling