added broadcast, and fixed some bugs