Fix setRefund bugs in serverd and tools.