fix bugs in buy/sell