Fixed race condition in trace()

Turns out it was caused by setTimeout(func, Math.random())
...well, that was foolish