minor fix on flag check