update tests and fix controller fn to extract the controller brokerid