updated logic to wait for outpuplugin