fix encode response crash