changing the signatures of foreach and channel_dec_ref_count