Fix filter function on messages