revert passing flags part added in @d4fcd2d

and some other changes from that commit that might have been problematic