Corrected some errors in encoder implementation