move debug flag check inside osb area