Added exception on wrong flag + test