Use correct index when try to find the type of the message