fix the bug that message always publisgh twice