Removed a bug in which messages were duplicated