Fix choice encoding

Fixes bug #15 - choice encoding had no tests and was broken
I don't understand this one. Can you please explain what you meant?