Fix logic error in ErrorPageFilter (fixes gh-1149)