Fix encode