Fix Encode part