fix race condition in document change detection (regression introduced with r8970)