more robust, and start pub after mqtt server is running