Fixed the code so it's able to find all messages.