revert change removing encode/decode handling -- it is now clear why this was needed...