Issue #5907: Fix issues of viewport set