Fix exporting to JSON