trying to fix encode error