added error handling to the chaining