fixed issues with publishing messages