finally fixed all the bugs in deal.