fix publish/subscribe model logic