Improving exception handling for filters, fixing #812