Fix bug of saving a JSON object