Minor fixes in message handling