Fix for to_json