Avoid race condition with hit test