Fix logCursorScopes

Close #4204