Fixed problem with working example

I believe I have fixed the problem with the working example. The problem was in the `__encode(d)` function.