fixed bug in message checking