Fixes to before_fiter