added invalid flag exception