fix inactive assert when publishing message with wrong type (fix #3714)