fixed: json flag + unit tests