Fixing problem with flags