fix a bug on broker; work on tests