Fixing handling of failed attempts to stop input
Fixing condition in publish method