Fix error handler for backend