Fixed some issues with json mode.