fix flag vars bug