Refacoring for fix message sending issue