fix reduction bug in cb
bugfixes in cb and gd