rescued encode from being fundamentally incorrect