almost done
fix encode error