fixes redundant flag removal