fixed a bug in the trace library, replaced some of the macros with functions.