Add temporary debug code to allow better debugging of races