flag/cond handling improvements