Tracing and bug fixes