Fix token encoding; closing Issue #1.