Fix messages' type is not set correctly