Fix $flag/$flags being leaked to global