Bugfix: handling possible EncodeException.