fixed bug with barcode flattening procedure