Use pointer to Encoder, fix encoding