fix bug of setting message type in ToMiddle when directly connecting with controller