fix on_publish bug