fixed bug in ean encoder and added some tests