Fix bug for before filter