fix to_json bug again