moving setFlags to Gap.