Fixes #673 and adds additional test for before filter