Minor EncodeDistance fixes