switched err manager as midleware