Fixes to avoid dead loops in pubsub cases