Filter source fixes

These two commits are semantically independent, but since they both modify the same test code there would be conflicts if they were both based on master and then merged. Hence I'm submitting both in a single pull request.