Fixed the problem to cast from message_cref/message_mref to generated cref/mref classes.