fix apply flags