started fixing flag setting