moved flag from constructor