fixed bug with duplicating messages