fixed a bug in performTrade.