added check for flags