Fixed many bugs on publish and masivePublish