Fixes to algebra json emitter