fix message/type detection