fix bug with duplicate messages