many fixes: race conditions (esp. for replays), scoping, etc