Properly check if a panel is enabled (issue 6821)