Fix encode() test