diff --git a/briar-core/src/org/briarproject/db/DatabaseComponentImpl.java b/briar-core/src/org/briarproject/db/DatabaseComponentImpl.java
index ffc1061c56d1ec4dc26b9011f0ec8517a97275e3..79113fbd4371c4a9dd79019bb1be273787b6752e 100644
--- a/briar-core/src/org/briarproject/db/DatabaseComponentImpl.java
+++ b/briar-core/src/org/briarproject/db/DatabaseComponentImpl.java
@@ -1133,9 +1133,11 @@ DatabaseCleaner.Callback {
 		} finally {
 			lock.writeLock().unlock();
 		}
-		// FIXME: MessageAddedEvent should only be broadcast if msg is visible
-		if(visible) callListeners(new MessageToAckEvent(c));
-		if(!duplicate) callListeners(new MessageAddedEvent(m.getGroup(), c));
+		if(visible) {
+			if(!duplicate)
+				callListeners(new MessageAddedEvent(m.getGroup(), c));
+			callListeners(new MessageToAckEvent(c));
+		}
 	}
 
 	public void receiveOffer(ContactId c, Offer o) throws DbException {
diff --git a/briar-core/src/org/briarproject/db/JdbcDatabase.java b/briar-core/src/org/briarproject/db/JdbcDatabase.java
index b3988605631e036362019bfa05ebe466f17a67c2..5d51ad10491df44a9e907ea1093f4849d17863c9 100644
--- a/briar-core/src/org/briarproject/db/JdbcDatabase.java
+++ b/briar-core/src/org/briarproject/db/JdbcDatabase.java
@@ -1077,8 +1077,8 @@ abstract class JdbcDatabase implements Database<Connection> {
 		}
 	}
 
-	public boolean containsVisibleGroup(Connection txn, ContactId c,
-			GroupId g) throws DbException {
+	public boolean containsVisibleGroup(Connection txn, ContactId c, GroupId g)
+			throws DbException {
 		PreparedStatement ps = null;
 		ResultSet rs = null;
 		try {
diff --git a/briar-tests/src/org/briarproject/messaging/simplex/SimplexMessagingIntegrationTest.java b/briar-tests/src/org/briarproject/messaging/simplex/SimplexMessagingIntegrationTest.java
index a32327b98d97765204bbe0ead560f3602274d408..0856bbb38bfe4679bad7bc39eee170768543299d 100644
--- a/briar-tests/src/org/briarproject/messaging/simplex/SimplexMessagingIntegrationTest.java
+++ b/briar-tests/src/org/briarproject/messaging/simplex/SimplexMessagingIntegrationTest.java
@@ -25,7 +25,7 @@ import org.briarproject.api.event.Event;
 import org.briarproject.api.event.EventListener;
 import org.briarproject.api.event.MessageAddedEvent;
 import org.briarproject.api.messaging.Group;
-import org.briarproject.api.messaging.GroupId;
+import org.briarproject.api.messaging.GroupFactory;
 import org.briarproject.api.messaging.Message;
 import org.briarproject.api.messaging.MessageFactory;
 import org.briarproject.api.messaging.MessageVerifier;
@@ -59,7 +59,6 @@ public class SimplexMessagingIntegrationTest extends BriarTestCase {
 	private final File testDir = TestUtils.getTestDirectory();
 	private final File aliceDir = new File(testDir, "alice");
 	private final File bobDir = new File(testDir, "bob");
-	private final Group group;
 	private final TransportId transportId;
 	private final byte[] initialSecret;
 	private final long epoch;
@@ -67,8 +66,6 @@ public class SimplexMessagingIntegrationTest extends BriarTestCase {
 	private Injector alice, bob;
 
 	public SimplexMessagingIntegrationTest() throws Exception {
-		GroupId groupId = new GroupId(TestUtils.getRandomId());
-		group = new Group(groupId, "Group", new byte[GROUP_SALT_LENGTH]);
 		transportId = new TransportId("id");
 		// Create matching secrets for Alice and Bob
 		initialSecret = new byte[32];
@@ -77,6 +74,7 @@ public class SimplexMessagingIntegrationTest extends BriarTestCase {
 		epoch = System.currentTimeMillis() - 2 * rotationPeriod;
 	}
 
+	@Override
 	@Before
 	public void setUp() {
 		testDir.mkdirs();
@@ -88,7 +86,7 @@ public class SimplexMessagingIntegrationTest extends BriarTestCase {
 		return Guice.createInjector(new TestDatabaseModule(dir),
 				new TestLifecycleModule(), new TestSystemModule(),
 				new CryptoModule(), new DatabaseModule(), new MessagingModule(),
-				new DuplexMessagingModule(), new SimplexMessagingModule(), 
+				new DuplexMessagingModule(), new SimplexMessagingModule(),
 				new SerialModule(), new TransportModule());
 	}
 
@@ -122,6 +120,8 @@ public class SimplexMessagingIntegrationTest extends BriarTestCase {
 				new byte[MAX_PUBLIC_KEY_LENGTH]);
 		ContactId contactId = db.addContact(bobAuthor, aliceId);
 		// Add the inbox group
+		GroupFactory gf = alice.getInstance(GroupFactory.class);
+		Group group = gf.createGroup("Group", new byte[GROUP_SALT_LENGTH]);
 		db.addGroup(group);
 		db.setInboxGroup(contactId, group);
 		// Add the transport and the endpoint
@@ -181,6 +181,8 @@ public class SimplexMessagingIntegrationTest extends BriarTestCase {
 				new byte[MAX_PUBLIC_KEY_LENGTH]);
 		ContactId contactId = db.addContact(aliceAuthor, bobId);
 		// Add the inbox group
+		GroupFactory gf = bob.getInstance(GroupFactory.class);
+		Group group = gf.createGroup("Group", new byte[GROUP_SALT_LENGTH]);
 		db.addGroup(group);
 		db.setInboxGroup(contactId, group);
 		// Add the transport and the endpoint
@@ -228,6 +230,7 @@ public class SimplexMessagingIntegrationTest extends BriarTestCase {
 		db.close();
 	}
 
+	@Override
 	@After
 	public void tearDown() {
 		TestUtils.deleteTestDirectory(testDir);
@@ -235,7 +238,7 @@ public class SimplexMessagingIntegrationTest extends BriarTestCase {
 
 	private static class MessageListener implements EventListener {
 
-		private boolean messageAdded = false;
+		private volatile boolean messageAdded = false;
 
 		public void eventOccurred(Event e) {
 			if(e instanceof MessageAddedEvent) messageAdded = true;