better publish logic