Fix MessageClass check when string is ending with a period '.'