update and fix the merchant script (fixes issue #254)