filter invalid messages