fix a stupid bug, and some more tracing