Added error handler middleware