Fixed some errors in encoder.go