Change flag check to be more C-like