Fix bug with flags