Added missing flag check