fix counting of messages