revise example encoding
fix bug, make it workable