port ES changes from Bitshares
https://github.com/bitshares/bitshares-core/issues/2240