barcode calculation fixed