instrumenting and performance fixes