better message validation with type-check