fix switch to main document