flags handling