Fixed bug in trace generation