Changed error handler to a status code