Fixed the trade market and added debug messages.