fix repeat messages, add test