Fixed bugs in the merchant api.