added debug tracing