was checking wrong flag before